package com.jimmy.medical.entity;

import javax.persistence.*;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

/**
 * 发送短息记录
 *
 * @author jimmy
 * @since 0.1
 */
@Entity
@Table(name = "messages")
public class Message extends AbstractEntity {
    /**
     * 短信内容
     */
    @Column(name = "content", length = 200)
    private String content;
    /**
     * 电话号码,多人逗号隔开
     */
    @Column(name = "mobile", length = 2000)
    private String mobile;
    /**
     * 发送会员
     */
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "member_id")
    @NotFound(action = NotFoundAction.IGNORE)
    private Member member;
    /**
     * 发送状态,Success:成功;Faild:失败
     */
    @Column(name = "status", length = 20)
    private String status;
    /**
     * 发送返回消息
     */
    @Column(name = "message", length = 100)
    private String message;
    /**
     * 发送成功条数
     */
    @Column(name = "success_counts")
    private int successCounts;

    @Column(name = "create_time", length = 20)
    private String createTime;
    @Column(name = "create_user", length = 50)
    private String createUser;

    @Column(name = "push_type", length = 1)
    private String pushType;

    @Column(name = "plan_msg_id", length = 1)
    private Long planMsgId;

    @Column(name = "is_read", length = 20)
    private String isRead;

    /**
     * 关联的订单
     */
    @Column(name = "order_id")
    private Long orderId;

    /**
     * 关联的工单
     */
    @Column(name = "flow_order_id")
    private Long flowOrderId;

    @Transient
    private Long userId;

    public String getIsRead() {
        return isRead;
    }

    public void setIsRead(String isRead) {
        this.isRead = isRead;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public Member getMember() {
        return member;
    }

    public void setMember(Member member) {
        this.member = member;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public int getSuccessCounts() {
        return successCounts;
    }

    public void setSuccessCounts(int successCounts) {
        this.successCounts = successCounts;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public String getPushType() {
        return pushType;
    }

    public void setPushType(String pushType) {
        this.pushType = pushType;
    }

    public Long getPlanMsgId() {
        return planMsgId;
    }

    public void setPlanMsgId(Long planMsgId) {
        this.planMsgId = planMsgId;
    }

    public String getPushTypeCn() {
        return "2".equals(pushType) ? "APP推送" : "短信";
    }

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public Long getFlowOrderId() {
        return flowOrderId;
    }

    public void setFlowOrderId(Long flowOrderId) {
        this.flowOrderId = flowOrderId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }
}
